|
DHTMLX Documentation |
grid.setHeader("A,<img src='some.gif'/>,C")The same thing works while loading data from XML, but you need to be sure the data is correctly escaped:
grid.attachFooter("A,<strong>B</strong>,C");
...The usage of ">" and "<" makes the code poorly readable, so instead of them CDATA sections can be used:
<column><img src='some.gif'></column>
...
<column><![CDATA[ <img src='some.gif'> ]]></column>
equal to = N
greater than > N
lesser than < N
lesser or equal <= N
greater or equal >= N
range of values N1 .. N2
grid.setHeaderOr they can be used with related XML tags in case of configuration from XML:
grid.attachHeader
grid.attachFooter
grid.setHeader("A,#master_checkbox,C");
grid.attachHeader("#text_filter,#rspan,#text_filter");
...Shortcuts don't work for data part of grid.
<column ... >#text_search</column>
grid=new...The function accepts 3 parameters:
grid._in_header_custom_label=function(tag,index,data){ //name contains "_in_header_"+shortcut_name
tag.innerHTML="works";
}
grid.setHeader("A,#custom_label,C");
...
A | works | B
grid=new...data - array of two elements;
grid._in_header_custom_label=function(tag,index,data){ //name contains "_in_header_"+shortcut_name
tag.innerHTML=data[0]+"works"+data[1];
}
grid.setHeader("A,#custom_label,C");
...
grid.setHeader("A,it is {#custom_label}!,C"); // => A | it works! | B
//data was equal to ["it","!"]
grid=new...In the above mentioned snippet we add an input button inside the header (we use data[0] because we need to preserve the existing label), and attach some code to this button, which will set all values in related column as "".
grid._in_header_clear_button=function(tag){ //name contains "_in_header_"+shortcut_name
tag.innerHTML=data[0]+"<input type='button' value='clear'>"; //HTML view
var grid = this; //store reference for further usage
tag.firstChild.onclick=function(tag,index){ //on button click
grid.forEachRow(function(id){ //for each row in grid
grid.cells(id,index).setValue(""); //clear cell value for related column
})
}
}
grid.setHeader("A,B{#clear_button},C");
...
grid=new...
grid._in_header_close_button=function(tag,index,data){ //name contains "_in_header_"+shortcut_name
tag.innerHTML=data[0]+"<input type='button' value='close'>"; //HTML view
var grid = this; //store reference for further usage
tag.firstChild.onclick=function(tag,index){ //on button click
grid.setColumnHidden(index,true); //hide related column
}
}
grid.setHeader("A,B{#close_button},C");
...
grid=new...All the previous samples set some HTML inside the header, but you can just modify the existing styles instead of setting new content.
grid._in_header_special=function(tag){ //name contains "_in_header_"+shortcut_name
tag.style.color="red"; //set style for existing header
tag.title="Warning!"; //set tooltip for header
}
grid.setHeader("A,B{#special},C");
...
grid=new...
grid._in_header_editable=function(tag){ //name contains "_in_header_"+shortcut_name
var grid=this;
tag.ondblclick=function(e){ //start edit on dbl-click
var val=tag.innerHTML; //get current header text
tag.innerHTML="<input type='text'><input type='button' value='done'>"
tag.firstChild.value=val; // set text in editor
tag.childNodes[1].onclick=function(){ //after clicking "done" button
tag.innerHTML=tag.firstChild.value; //replace editor with new text
}
}
}
grid.setHeader("A,B{#editable},C");
...
dhtmlXGridObject.prototype._in_header_SOME=function(tag,index){
....
}